#pragma once

#include "Encrypter.h"
#include "SymmetricKey.h"
#include <memory>

namespace kryptos { namespace cryptography {

class SymmetricEncrypter : public Encrypter
{
public:
    SymmetricEncrypter(SymmetricKey &key);
    virtual ~SymmetricEncrypter();

    // Encrypter interface
    virtual int encryptFile(const std::string &filepath, const std::string &output);
    virtual int encryptFile(const std::string &filepath, std::ostream &output);
    virtual int encryptAndEncodeFile(const std::string &filepath, std::ostream &output);

    virtual int encryptBuffer(const char* buffer, int len, std::vector<char> &output);
    virtual int encryptAndEncodeBuffer(const char* buffer, int len, std::vector<char> &output);

    virtual int decryptFile(const std::string &filepath, const std::string &output);
    virtual int decryptFile(std::istream &inputfile, std::ostream &output);
    virtual int decryptFile(std::istream &inputfile, unsigned long long cipherEnd, std::ostream &output);
    virtual int decryptBuffer(const char* buffer, int len, std::vector<char> &output);

protected:

    SymmetricKey& m_key;
    int           m_keyBlockSize, m_blockSize;

private:

    struct Impl;
    std::auto_ptr<Impl> m_impl;
};

}}
